import { getDetail } from '@/network/detail';
import {ref, onMounted} from 'vue'
import {useRoute} from 'vue-router'
export function useDetail() {
   
    const route = useRoute()
    const goods = ref({})
    async function getGoods() {
        const res = await getDetail(route.params.id)
        // console.log(res);
        goods.value = res.result
    }

    onMounted(() => {
        getGoods()
    })

    return {goods}
}